<template>
	<news-list @itemClick="toDetail()" :newsList="newsList">
		
	</news-list>
</template>

<script>
	import newsList from '../../components/news-list/news-list.vue'
	export default {
		data() {
			return {
				newsList:[]
			}
		},
		components:{
			'news-list':newsList
		},
		onLoad() {
			this.getNews()
		},
		methods: {
			async getNews(){
				const res = await this.$myRequest({
					url:'/api/getnewslist'
				})
				this.newsList = res.data.message
			},
			toDetail(id){
				console.log(id)
				uni.navigateTo({
					url:'../newsdetail/newsdetail?id='+id
				})
			}
		}
	}
</script>

<style lang="scss">
	.news{
		.news_item{
			padding: 10rpx 20rpx;
			display: flex;
			border: 1px solid #007AFF;
			image{
				width: 200rpx;
				height: 200rpx;
				padding-right: 20rpx;
			}
			.right{
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				.title{
					font-size: 30rpx;	
			}
			.info{
				font-size: 26rpx;
				text:nth-child(2){
					margin-left: 30rpx;
				}
			}
			}
			
		}
	}
</style>
